<%@ page language="java" import="java.util.*" import="st.student" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style type="text/css">
	#a{
	margin:50px auto;
	width:500px;
	border-style:solid;
	border-width:1px;
	border-clolor:black;
	border-spacing:0px;
	}
	.b{
	border-style:solid;
	border-width:2px;
	border-color:black;
	}
	</style> 
	
	 </head>
  
  <body>
   <%
   String []s=new String[]{"学好","姓名","性别","班级","成绩"};
   out.println("<table id='a'>");
   for(int i=0; i<s.length;i++)
   {
    out.println("<th class='b'>");
    out.println(s[i]);
    out.println("</th>");
   }
   ArrayList<student> array=new ArrayList<student>();
   array.add(new student("001","李白","男",01,723));
   array.add(new student("002","孟浩然","男",02,689));
   array.add(new student("003","杨玉环","女",03,600));
   java.util.Iterator<student> i=array.iterator();
   while(i.hasNext()){
   student s1=(student)i.next();
   out.println("<tr>");
   out.println("<td class='b'>");
   out.println(s1.num);
   out.println("</td>");
   out.println("<td class='b'>");
   out.println(s1.name);
   out.println("</td>");
   out.println("<td class='b'>");
   out.println(s1.sex);
   out.println("</td>");
    out.println("<td class='b'>");
   out.println(s1.cl);
   out.println("</td>");
    out.println("<td class='b'>");
   out.println(s1.grade);
   out.println("</td>");
   out.println("</tr>");
   }
   out.println("</table>");
       %>
  </body>
</html>
